//app.js
App({

  /**
   * 生命周期函数--监听小程序初始化
   */
  onLaunch: function(options) {
    //调用API从本地缓存中获取数据K
    this.initGlobalData();

  },

  onShow: function() {
    this.initGlobalData();

  },
  initGlobalData: function(callBack) {
    
    //如果是第三方平台 重新赋值
    if (wx.getExtConfig) {
     
      wx.getExtConfig({
        success: function(res) {
       
          if (res.extConfig.custID > 0) {
           
            var app = getApp();
            var extConfig = res.extConfig;
            app.globalData.custID = extConfig.custID;
            app.globalData.zpAppid = extConfig.Appid;
            app.globalData.secret = "";
            app.globalData.manuName = extConfig.manuName;
            app.globalData.ComponentSysCode = extConfig.ComponentSysCode;
            app.globalData.zhengpinAppid = extConfig.zpAppid;
            app.globalData.isAuthComponent = true;
         
        

          }

        },
        complete: function(res) { //接口调用失败/结束的回调函数
          if (callBack) {
            callBack();
          }
        }
      })
    }

  },
  globalData: {
    apiurl: "https://mobileapi.v4.winmobi.cn/", //API请求地址127.0.0.1:84 https://mobileapi.v4.winmobi.cn
    imgurl: "https://img4.winmobi.cn/", //图片地址
    upFileUrl: "https://upload.winmobi.cn/",
    zpAppid: "wxef247a8b2c27cfc7",
    secret: "72f877fcbd3c951ac272b2ddd6420da5",
    custID: 200063,
    manuName: 'v4test',
    ComponentSysCode: "",
    zhengpinAppid: "",
    isAuthComponent: false //是否授权第三方平台 false走标准流程 true走第三方平台
  }
})